authApp.value('page','school_dataFill');

authApp.controller("dataFillController",function($scope,$http,page,$chineseNum){
    var requestJson={};
    $scope.submitStatehide = false;
    $scope.submitState=function() {
        $http({
            method: 'get',
            url: apis.querySchoolState,
            data: '',
        }).success(function (response) {
            if (response.code == "000000") {
                if (response.data.s_state == "1") {
                    $scope.submitStatehide = false;
                } else if (response.data.s_state == "2") {
                    $scope.submitStatehide = true;
                }
            } else {
                alert(response.errorMsg);
            }
        }).error(function () {
            alert("服务器打瞌睡了，请稍等！");
        })
    }
    $scope.getAML=function(){
        $http({
            method:'get',
            url:apis.queryAuthExportGroupMapPage,
            data:requestJson,
        }).success(function(response){
            if(response.code=="000000"){
                $scope.list=response.data;
                angular.forEach($scope.list,function(data,index,array){
                    var number = index + 1;
                    data.chindexNum=$chineseNum(number);
                    data.listIndex = number;
                })

            }else{
                alert(response.errorMsg);
            }
        }).error(function(){
            alert("服务器打瞌睡了，请稍等！");
        })

    }

    $scope.turnTo=function(pid,num){
        location.href="view_details.html?pid="+pid+"&preNum="+num;
    }

    $scope.getAML();
 

    $scope.submit=function(){
       /* if($scope.submitState){
            alert("已提交，不可重复提交");
        }*/
        if(window.confirm("提交后不可修改，是否确定提交？")){
            $http({
                method:'get',
                url:apis.updateSchoolState,
                data:'',
            }).success(function(response){
                if(response.code=="000000"){
                    alert("提交成功");
                }else{
                    alert(response.errorMsg);
                }
            }).error(function(){
                alert("服务器打瞌睡了，请稍等！");
            })
        }
    }

    $scope.yetsubmit=function(){
        alert("已提交，不可重复提交！");
    }
})